package Annotation;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class AnnotationDemo3 {

    @MyTest
    public void test1(){
        System.out.println("=====test1=====");
    }


    public void test2(){
        System.out.println("=====test2=====");
    }

    @MyTest
    public void test3(){
        System.out.println("=====test3=====");
    }

    public static void main(String[] args) throws Exception {
        AnnotationDemo3 t=new AnnotationDemo3();
        Class c=AnnotationDemo3.class;
        Method[] methods = c.getDeclaredMethods();
        for (Method method : methods) {
            if (method.isAnnotationPresent(MyTest.class))
            {
                method.invoke(t);
            }
        }
    }

}
